<html>

<head>
    <title><?= $title; ?></title>
    <base href="<?= $base_url . $version . '/'; ?>">
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="shortcut icon" href="../assets/images/favicon.png">

    <!-- CSS plugins -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.1.0/styles/default.min.css">

    <!-- ButterDocs CSS -->
    <link rel="stylesheet" href="../assets/css/themes/light.css" id="theme-light">
    <link rel="stylesheet" href="../assets/css/themes/dark.css" id="theme-dark" disabled>
    <link rel="stylesheet" href="../assets/css/butterdocs.css">
</head>

<body>
    <section class="layout">
        <!-- Mobile header -->
        <section class="header">
            <a class="menu-button" onclick="toggleSidenav();"><i class="fas fa-bars"></i></a>
            <a href="../<?= $version; ?>">
                <?= $application; ?>
            </a>
            <?php if (!empty($git)) : ?>
                <a href="<?= $git; ?>" target="_blank" class="menu-edit"><i class="fas fa-pencil-alt"></i></a>
            <?php endif; ?>
        </section>

        <!-- Edit on GitHub button -->
        <?php if (!empty($git)) : ?>
            <section class="edit">
                <a href="<?= $git; ?>" target="_blank">
                    <i class="fas fa-pencil-alt"></i>
                    <span>
                        <?= APP_CONFIG['language']['edit_page'] ?? 'Edit this page'; ?><br>
                        <strong><?= APP_CONFIG['language']['github'] ?? 'on GitHub'; ?></strong>
                    </span>
                </a>
            </section>
        <?php endif; ?>

        <!-- Sidenav menu -->
        <section class="menu">
            <a href="../<?= $version; ?>">
                <img src="../assets/images/logo.png" class="logo">
            </a>
            <?php if (APP_CONFIG['search'] ?? true) : ?>
                <form action="search" class="search-bar">
                    <input type="search" name="q" required placeholder="Search...">
                </form>
            <?php endif; ?>
            <div class="dropdown">
                <a class="dropdown-toggle" data-bs-toggle="dropdown">
                    <?= $version; ?>
                    <?php if ($version == $last_version) : ?>
                        <span><?= APP_CONFIG['language']['latest'] ?? '(latest)'; ?></span>
                    <?php endif; ?>
                </a>
                <ul class="dropdown-menu">
                    <?php foreach ($version_list as $v) : ?>
                        <li>
                            <a href="../<?= $v; ?>" class="dropdown-item" href="#">
                                <?= $v; ?>
                                <?php if ($v == $last_version) : ?>
                                    <span><?= APP_CONFIG['language']['latest'] ?? '(latest)'; ?></span>
                                <?php endif; ?>
                            </a>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </div>
            <?= $menu; ?>
        </section>

        <!-- Content -->
        <section class="content">
            <?= $content; ?>

            <!-- Copyright -->
            <section class="copyright">
                <hr>
                Powered by <a href="https://github.com/eugabrielsilva/butterdocs" target="_blank">ButterDocs</a>
            </section>
        </section>
    </section>

    <!-- JS plugins -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.1.0/highlight.min.js"></script>

    <!-- ButterDocs JS -->
    <script src="../assets/js/butterdocs.js"></script>
</body>

</html>